package com.ft.oa.web.development;


import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ft.oa.domain.development.CompetitorAttachment;
import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.service.development.CompetitorAttachmentService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * 竞品-附件
 */
@RestController
@RequestMapping("/product/competitor/attachment")
public class CompetitorAttachmentController {

    @Resource
    private CompetitorAttachmentService competitorAttachmentService;

    /**
     * 新增
     * @param competitorAttachment
     * @return
     */
    @PostMapping("/add")
    public ApiResult add(@RequestBody CompetitorAttachment competitorAttachment){
        competitorAttachmentService.add(competitorAttachment);
        return ApiResult.simpleSuccess();
    }

    /**
     * 删除
     * @return
     */
    @PostMapping("/del")
    public ApiResult del(@RequestBody CompetitorAttachment competitorAttachment){
        competitorAttachmentService.del(competitorAttachment);
        return ApiResult.simpleSuccess();
    }


    /**
     * 编辑
     * @param competitorAttachment
     * @return
     */
    @PostMapping("/edit")
    public ApiResult edit(@RequestBody CompetitorAttachment competitorAttachment){
        competitorAttachmentService.edit(competitorAttachment);
        return ApiResult.simpleSuccess();
    }

    /**
     * 条件分页
     * @return
     */
    @PostMapping("/page")
    public ApiResult page(@RequestBody CompetitorAttachment condition){
        Page<CompetitorAttachment> result = competitorAttachmentService.page(condition);
        return ApiResult.successWithData(result);
    }

}
